package com.ysstech.reportworld.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.baomidou.mybatisplus.annotation.TableId;

import java.time.LocalDateTime;

import com.baomidou.mybatisplus.annotation.TableField;

import java.io.Serializable;
import java.util.List;
import java.util.Objects;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * <p>
 * 报表世界函数信息表
 * </p>
 *
 * @author lishuangliang
 * @since 2022-05-19
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("report_world_datasql")
public class DataSql extends Model<DataSql> {

    private static final long serialVersionUID = 1L;

    @TableId("ID")
    private String id;

    /**
     * SQL名称
     */
    @TableField("NAME")
    private String name;
    /**
     * 中文名称
     */
    @TableField("CHINESE_NAME")
    private String chineseName;
    /**
     * SQL说明
     */
    @TableField("DESCRIPTION")
    private String description;

    /**
     * SQL语句
     */
    @TableField("DATASQL")
    private String datasql;

    /**
     * SQL类型 1.函数 2.视图 3.语句 4.序列 5存储过程 6同义词 7字典语句 8报表采集
     */
    @TableField("TYPE")
    private Integer type;

    /**
     * 数据库类型 1-ORACLE,2-MYSQl,3-DM
     */
    @TableField("DATABASE_TYPE")
    private String dataBaseType;
    /**
     * 版本号
     */
    @TableField("VERSION")
    private String version;

    @TableField("STATUS")
    private Integer status;

    @TableField("ADD_TIME")
    private LocalDateTime addTime;

    @TableField("ADD_USER")
    private String addUser;

    @TableField("EDIT_TIME")
    private LocalDateTime editTime;

    @TableField("EDIT_USER")
    private String editUser;

    @TableField("DELETE_REASON")
    private String deleteReason;

    @Override
    protected Serializable pkVal() {
        return null;
    }

    @TableField(exist = false)
    private String strType;

    @TableField(exist = false)
    private String strStatus;
    // 所属模块
    @TableField(exist = false)
    private String modular;
    //所属客户
    @TableField(exist = false)
    private String customer;
    //所属报表
    @TableField(exist = false)
    private String report;

    // 所属模块
    @TableField(exist = false)
    private String strModular;
    //所属客户
    @TableField(exist = false)
    private String strCustomer;
    //所属报表
    @TableField(exist = false)
    private String strReport;

    //一个表对应客户集合
    @TableField(exist = false)
    private List<DataCustomer> listCustomer;
    //一个表对应模块集合
    @TableField(exist = false)
    private List<DataModular> listModular;
    //一个表对应报表集合
    @TableField(exist = false)
    private List<DataReport> listReport;

    @TableField(exist = false)
    private List<DataSql> listDataSql;

    //一个表对应客户集合
    @TableField(exist = false)
    private List<String> listCustomerStr;
    @TableField(exist = false)
    private List<String> listModularStr;
    @TableField(exist = false)
    private List<String> listReportStr;
    /**
     * SQL修改记录信息
     */
    @TableField(exist = false)
    private List<DataDemandBug> listDataDemandBug;

    @TableField(exist = false)
    private Integer count;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        DataSql that = (DataSql) o;
        return Objects.equals(name, that.name);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name);
    }
}
